<ui:composition template="/WEB-INF/templates/login-template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

	<ui:param name="pageName" value="Handover Assets" />
	
	<ui:define name="menu"></ui:define>
	<ui:define name="submenu"></ui:define>
	<ui:define name="sidebar">
		<ui:include src="/WEB-INF/templates/public-sidebar.xhtml" />
	</ui:define>
	<ui:define name="content">	
		
		<h:outputText value="Handover Asset(s)" styleClass="outputTextTitle"/>	
		<h:form> 
		 <p:growl/>	
		
		<p:panel header="Employee Details" >            
           
           <h:panelGrid columns="6" cellspacing="8" columnClasses="employeeDetailLabel,gridCellMiddleLeftAligned, employeeDetailText, employeeDetailLabel,gridCellMiddleLeftAligned, employeeDetailText" >
		          
           <h:outputLabel value="Asset Code" />
           <h:outputLabel value=":" />
           <h:outputText value="#{assetHandoverDetailsBean.assetRequest.assetReferenceCode}" />
           
           <h:outputLabel value="Request Date" />
           <h:outputLabel value=":" />
           <h:outputText value="#{assetHandoverDetailsBean.assetRequest.requestDate}" >
           		<f:convertDateTime pattern="dd-MMM-yyyy HH:mm a" timeZone="#{assetHandoverDetailsBean.timeZone}"/> 
           </h:outputText>

           <h:outputLabel value="Employee Name " />
           <h:outputLabel value=":" />
           <h:outputText value="#{assetHandoverDetailsBean.assetRequest.employee.firstName} #{assetHandoverDetailsBean.assetRequest.employee.lastName}" />
           
           <h:outputLabel value="System Administrator " />
           <h:outputLabel value=":" />
           <h:outputText value="#{assetHandoverDetailsBean.assetRequest.assigedByEmployee.firstName} #{assetHandoverDetailsBean.assetRequest.assigedByEmployee.lastName}" />
		              
           <h:outputLabel value="Recommended By" />
           <h:outputLabel value=":" />
           <h:outputText value="#{assetHandoverDetailsBean.assetRequest.recommendedBy.firstName} #{assetHandoverDetailsBean.assetRequest.recommendedBy.lastName}" />

           <h:outputLabel value="Approved By " />
           <h:outputLabel value=":" />
           <h:outputText value="#{assetHandoverDetailsBean.assetRequest.approvedBy.firstName} #{assetHandoverDetailsBean.assetRequest.approvedBy.lastName}"  />
           
          </h:panelGrid>
          <h:outputFormat value="Asset Details" style="font-weight:bold;color: #00A2DE;" />
           <p:dataTable  value="#{assetHandoverDetailsBean.assetDetailsList}" var="newAsset" > 
		            <p:column headerText="Asset Type"> 
		              	<h:outputText value="#{newAsset.assetDetails.assetType}" />                 
		            </p:column>  
		  
		            <p:column headerText="Required On"> 
		              	<h:outputText value="#{newAsset.assetDetails.requiredDate}" > 
		              		<f:convertDateTime pattern="dd-MMM-yyyy" timeZone="#{assetHandoverDetailsBean.timeZone}"/>
		              	</h:outputText> 	               
		            </p:column>  
		            
		            <p:column headerText="Return Date"> 
		              	<h:outputText value="#{newAsset.assetDetails.expectedReturnDate}" >
		              		<f:convertDateTime pattern="dd-MMM-yyyy" timeZone="#{assetHandoverDetailsBean.timeZone}"/>
		              	</h:outputText>                  
		            </p:column>  
		            
		            <p:column headerText="Purpose"> 
		              	<h:outputText value="#{newAsset.assetDetails.purpose}" />  	               
		            </p:column>  
		            
		            <p:column headerText="Remarks"> 
		              	<h:outputText value="#{newAsset.assetDetails.remarks}" />                 
		            </p:column>  
		            
		            <p:column headerText="Status"> 
		            	<h:outputText value="#{newAsset.assetStatus}" />
		            </p:column>
		            
		            <p:column headerText="Asset Code"> 
		            	<h:outputText value="#{newAsset.assetMaster.assetCode}" />
		            </p:column>	
		            
		            <p:column headerText="Assigned Date"> 
		            	<h:outputText value="#{newAsset.assetMaster.assignedDate}">
		            		<f:convertDateTime pattern="dd-MMM-yyyy" timeZone="#{assetHandoverDetailsBean.timeZone}"/>
		            	</h:outputText>
		            </p:column>		
		            
		            <p:column headerText="Asset Returned" > 
		             	<p:commandButton icon="ui-icon-search" value="Returned" oncomplete="assetHandoverDialog.show()" update="@form">
							<f:setPropertyActionListener target="#{assetHandoverDetailsBean.assetHistory}" value="#{newAsset}"></f:setPropertyActionListener>
						</p:commandButton>
		            </p:column>       
              </p:dataTable>
                    
          </p:panel> 
      			<p:commandButton value="Back" onclick="history.back();" style="float:right;" />
		 <p:dialog hideEffect="fade" showEffect="fade"
				header="Asset Handover Details "
				id="assetHandoverDialog" widgetVar="assetHandoverDialog" resizable="false"
				modal="true" >
				
				<h:panelGrid columns="2" id="handover">
    			         
			          <h:panelGrid columns="3" cellspacing="8" columnClasses="employeeDetailLabel,gridCellMiddleLeftAligned, employeeDetailText" >
			          
				           <h:outputLabel value="Asset Code" />
				           <h:outputLabel value=":" />
				           <h:outputLabel value="#{assetHandoverDetailsBean.assetHistory.assetMaster.assetCode}" />
				           
				           <h:outputLabel value="Asset Name" />
				           <h:outputLabel value=":" />
				           <h:outputLabel value="#{assetHandoverDetailsBean.assetHistory.assetMaster.assetName}" />
				           
				           <h:outputLabel value="Asset Model" />
				           <h:outputLabel value=":" />
				           <h:outputLabel value="#{assetHandoverDetailsBean.assetHistory.assetMaster.model}" />
			          		
			          	   <h:outputLabel value="Asset Status in Master Table" />
				           <h:outputLabel value=":" />
				           <p:selectOneMenu value="#{assetHandoverDetailsBean.assetStatus}" >
				           		<f:selectItems value="#{assetHandoverDetailsBean.assetStatusMap}" />
				           </p:selectOneMenu>
			          </h:panelGrid>
			          
			          <h:panelGrid columns="3">
			          	
			          	   <h:outputLabel value="Power Card" />
				           <h:outputLabel value=":" />
				           <p:selectOneMenu value="#{assetHandoverDetailsBean.assetHistory.powerCardStatus}" >
				           		<f:selectItem itemLabel="--Select--" itemValue="" />
								<f:selectItem itemLabel="Working" itemValue="Working" />
								<f:selectItem itemLabel="Repaired" itemValue="Repaired" />
				           </p:selectOneMenu>
				           
				           <h:outputLabel value="CPU" />
				           <h:outputLabel value=":" />
				           <p:selectOneMenu value="#{assetHandoverDetailsBean.assetHistory.cpuStatus}" >
				           		<f:selectItem itemLabel="--Select--" itemValue="" />
								<f:selectItem itemLabel="Working" itemValue="Working" />
								<f:selectItem itemLabel="Repaired" itemValue="Repaired" />
				           </p:selectOneMenu>
				           
				           <h:outputLabel value="Mother Board" />
				           <h:outputLabel value=":" />
				           <p:selectOneMenu value="#{assetHandoverDetailsBean.assetHistory.motherBoardStatus}">
				           		<f:selectItem itemLabel="--Select--" itemValue="" />
								<f:selectItem itemLabel="Working" itemValue="Working" />
								<f:selectItem itemLabel="Repaired" itemValue="Repaired" />
				           </p:selectOneMenu>
				           
				           <h:outputLabel value="RAM" />
				           <h:outputLabel value=":" />
				           <p:selectOneMenu value="#{assetHandoverDetailsBean.assetHistory.ramStatus}" >
				           		<f:selectItem itemLabel="--Select--" itemValue="" />
								<f:selectItem itemLabel="Working" itemValue="Working" />
								<f:selectItem itemLabel="Repaired" itemValue="Repaired" />
				           </p:selectOneMenu>
				           
				           <h:outputLabel value="Hard Disk" />
				           <h:outputLabel value=":" />
				           <p:selectOneMenu value="#{assetHandoverDetailsBean.assetHistory.hardDiskStatus}" >
				           		<f:selectItem itemLabel="--Select--" itemValue="" />
								<f:selectItem itemLabel="Working" itemValue="Working" />
								<f:selectItem itemLabel="Repaired" itemValue="Repaired" />
				           </p:selectOneMenu>
				           
				           <h:outputLabel value="CD/DVD Drive" />
				           <h:outputLabel value=":" />
				           <p:selectOneMenu value="#{assetHandoverDetailsBean.assetHistory.cdOrDVDDriveStatus}" >
				           		<f:selectItem itemLabel="--Select--" itemValue="" />
								<f:selectItem itemLabel="Working" itemValue="Working" />
								<f:selectItem itemLabel="Repaired" itemValue="Repaired" />
				           </p:selectOneMenu>
				           
				           <h:outputLabel value="Final Asset Status" />
				           <h:outputLabel value=":" />
				           <p:selectOneMenu value="#{assetHandoverDetailsBean.assetHistory.otherDevicesStatus}">
								<f:selectItem itemLabel="Working" itemValue="Working" />
								<f:selectItem itemLabel="Repaired" itemValue="Repaired" />
				           </p:selectOneMenu>
			          </h:panelGrid>			       
			   </h:panelGrid>	
			   <h:panelGrid>
			   		<h:outputLabel value="Final Remarks : " />
			   		<p:inputTextarea value="#{assetHandoverDetailsBean.assetHistory.handoverRemarks}" style="width:600px;"/>
			   </h:panelGrid>
	         
				<h:panelGroup style="float:right;">								
					<p:commandButton value="Received" actionListener="#{assetHandoverDetailsBean.assetHandoverListener}" update="growl handover"/>
					<p:commandButton id="closeButton" process="@this" value="Close" oncomplete="assetHandoverDialog.hide()" update="@form"/>	
				</h:panelGroup>	
			</p:dialog> 
		
		
         <p:growl id="growl"/>
     </h:form>
	</ui:define>
	
</ui:composition>
